/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.taxigang.server;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.google.appengine.api.datastore.Key;
import com.taxigang.shared.ChitInfo;
import com.taxigang.shared.TaxiGanguserInfo;

/**
 *
 * @author hall
 */
@Entity
@Table(name = "PAGE")
@NamedQueries({	@NamedQuery(	name = "Page.findAll", 				query = "SELECT a FROM Page a ")}) 
public class Page implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = PAGEKEY, nullable = false)
    private Key key;
    @Column(name = PAGENAME, nullable = true)
    private String pageName;
    @Column(name = PAGEID, nullable = true)
    private String pageId;
    @Column(name = PAGEACCESSTOKEN, nullable = true)
    private String pageAccessToken;
	@Column(name = GEOBOX, nullable = true)
	private long geobox;

    public static final  String PAGEKEY="PAGEKEY";
    public static final  String PAGENAME="PAGENAME";
    public static final  String PAGEID="PAGEID";
    public static final  String PAGEACCESSTOKEN="PAGEACCESSTOKEN";
    public static final  String GEOBOX="GEOBOX";
        
    public Page(String name, long geobox, String id, String accessToken) {
    	pageName = name;
    	this.geobox = geobox;
    	pageId = id;
    	pageAccessToken = accessToken;
    }
    


    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Page)) {
            return false;
        }
        Page other = (Page) object;
        if ((this.key == null && other.key != null) || (this.key != null && !this.key.equals(other.key))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Page " + pageName + " "+ pageId+ " "+ geobox;
    }



	public String[] getPageId() {
		String[] pageDetails = {pageId, pageAccessToken};
		return pageDetails;
	}


	public long getGeobox() {
		return geobox;
	}

}
